﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.hud {
    import Engine.Classes.*;
    import flash.events.*;
    import flash.display.*;
    import Classes.*;

    public class EnergyHead extends AutoAnimatedBitmap {

        public static const STOP:String = "stop";
        public static const LOSE_ENERGY:String = "useenergy";
        public static const GAIN_ENERGY:String = "gainenergy";
        public static const NO_ENERGY:String = "noenergy";
        public static const GAIN_ENERGY_FRAME:int = 67;
        public static const LOSE_ENERGY_FRAME:int = 155;
        public static const NO_ENERGY_FRAME:int = 1;
        public static const GAIN_ENERGY_END:int = 154;
        public static const LOSE_ENERGY_END:int = 209;
        public static const NO_ENERGY_END:int = 66;

        public var headAsset:AnimatedBitmap;
        protected var curFrame:String;
        protected var bFirstStart:Boolean = false;

        public function EnergyHead(_arg1:Bitmap){
            super(_arg1.bitmapData, 203, 38, 52, 24);
            this.stop();
        }
        public function goToFrame(_arg1:String):void{
            if (this.bFirstStart == false){
                this.bFirstStart = true;
                return;
            };
            this.curFrame = _arg1;
            switch (this.curFrame){
                case GAIN_ENERGY:
                    this.currentFrame = GAIN_ENERGY_FRAME;
                    this.play();
                    break;
                case LOSE_ENERGY:
                    this.currentFrame = LOSE_ENERGY_FRAME;
                    this.play();
                    break;
                case NO_ENERGY:
                    this.currentFrame = NO_ENERGY_FRAME;
                    this.play();
                    break;
            };
        }
        override public function updateMe(_arg1:Event):void{
            this.checkEnd();
            var _local2:Number = GlobalEngine.getTimer();
            var _local3:Number = (_local2 - curTime);
            curTime = _local2;
            super.onUpdate((_local3 / 1000));
        }
        private function checkEnd():void{
            var _local2:Number;
            var _local3:Number;
            var _local1:Number = this.currentFrame;
            switch (this.curFrame){
                case GAIN_ENERGY:
                    _local2 = GAIN_ENERGY_END;
                    _local3 = GAIN_ENERGY_FRAME;
                    break;
                case LOSE_ENERGY:
                    _local2 = LOSE_ENERGY_END;
                    _local3 = LOSE_ENERGY_FRAME;
                    break;
                case NO_ENERGY:
                    _local2 = NO_ENERGY_END;
                    _local3 = NO_ENERGY_FRAME;
                    break;
            };
            if ((((_local1 >= (_local2 - 1))) || ((_local1 < _local3)))){
                this.stop();
            };
        }

    }
}//package Display.hud 
